﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Collections.ObjectModel;
using System.Windows.Shapes;

namespace TeamService
{
    /// <summary>
    /// Select.xaml 的交互逻辑
    /// </summary>
    public partial class Select : Window
    {
        public Select()
        {
            InitializeComponent();
            this.Closing += Select_Closing;
        }

        private void Select_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if(Result.Count>0)
            {
                this.DialogResult = true;
            }
        }

        public List<Access.Member> Result { get; set; } = new  List<Access.Member>();

        private void MemberProvider_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var li = sender as ListBox;
            foreach(var i in li.SelectedItems)
            {
                Result.Add(i as Access.Member);
            }
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }
    }
}
